Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename some indices #6124

Merged
merged 1 commit into from
Nov 4, 2024
Merged

Rename some indices #6124

merged 1 commit into from
Nov 4, 2024

Conversation

gassmoeller
Copy link
Member

I was trying to understand #6116 and got stuck, because the block indices are named a bit confusingly. This PR just tries to make the use of the block indices a bit more consistent and easier to read. Note that in some places we create block vectors with only the Stokes blocks (velocity and/or pressure blocks) and translate between full solution vectors and only the Stokes vectors. We currently assert that those indices are the same between those two vectors (velocity block == 0; pressure block == 1 (iterative solver) or 0 (direct solver)), which is why I used the same block index variables for both. This could theoretically change in the future, but it hasnt in the past ten years, and until we do I just think it is easier to read distributed_stokes_solution.block(velocity_block_index) than distributed_stokes_solution.block(0) or introducing another index variable which just happens to be the same as the existing one.

This PR should not change any tests.

const unsigned int pressure_block_index = (parameters.include_melt_transport) ?
introspection.variable("fluid pressure").block_index
: introspection.block_indices.pressure;
(void) velocity_block_index;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it already was like this, but why are we casting to void here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are casting to void to silence compiler warnings. In some branch of the code the indices may only be used in asserts, and if those are removed in release mode then the variables may not be used. The compiler warns about this, but if we cast to void the compiler accepts this as a proper use of the variable.

@gassmoeller
Copy link
Member Author

The test failures with deal.II master are unrelated, see my fix for deal.II here: dealii/dealii#17838

@tjhei tjhei merged commit a36072f into geodynamics:main Nov 4, 2024
7 of 8 checks passed
@gassmoeller gassmoeller deleted the improve_names branch November 5, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants